package com.mypackage.diary.modle;

// Generated Oct 28, 2014 3:47:35 PM by Hibernate Tools 4.0.0

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Diary generated by hbm2java
 */
@Entity
@Table(name = "Diary")
public class Diary implements java.io.Serializable {

	private int diaryId;
	private UserProfile userProfile;
	private Serializable title;
	private Serializable body;
	private Serializable excerpt;
	private boolean isCommentClosed;
	private int privacy;
	private Date created;
	private Date modified;
	private Set<DiaryPermission> diaryPermissions = new HashSet<DiaryPermission>(
			0);
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<Category> categories = new HashSet<Category>(0);

	public Diary() {
	}

	public Diary(int diaryId, UserProfile userProfile, Serializable title,
			Serializable body, boolean isCommentClosed, int privacy,
			Date created) {
		this.diaryId = diaryId;
		this.userProfile = userProfile;
		this.title = title;
		this.body = body;
		this.isCommentClosed = isCommentClosed;
		this.privacy = privacy;
		this.created = created;
	}

	public Diary(int diaryId, UserProfile userProfile, Serializable title,
			Serializable body, Serializable excerpt, boolean isCommentClosed,
			int privacy, Date created, Date modified,
			Set<DiaryPermission> diaryPermissions, Set<Comment> comments,
			Set<Category> categories) {
		this.diaryId = diaryId;
		this.userProfile = userProfile;
		this.title = title;
		this.body = body;
		this.excerpt = excerpt;
		this.isCommentClosed = isCommentClosed;
		this.privacy = privacy;
		this.created = created;
		this.modified = modified;
		this.diaryPermissions = diaryPermissions;
		this.comments = comments;
		this.categories = categories;
	}

	@Id
	@Column(name = "DiaryId", unique = true, nullable = false)
	public int getDiaryId() {
		return this.diaryId;
	}

	public void setDiaryId(int diaryId) {
		this.diaryId = diaryId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AuthorId", nullable = false)
	public UserProfile getUserProfile() {
		return this.userProfile;
	}

	public void setUserProfile(UserProfile userProfile) {
		this.userProfile = userProfile;
	}

	@Column(name = "Title", nullable = false)
	public Serializable getTitle() {
		return this.title;
	}

	public void setTitle(Serializable title) {
		this.title = title;
	}

	@Column(name = "Body", nullable = false)
	public Serializable getBody() {
		return this.body;
	}

	public void setBody(Serializable body) {
		this.body = body;
	}

	@Column(name = "Excerpt")
	public Serializable getExcerpt() {
		return this.excerpt;
	}

	public void setExcerpt(Serializable excerpt) {
		this.excerpt = excerpt;
	}

	@Column(name = "IsCommentClosed", nullable = false)
	public boolean isIsCommentClosed() {
		return this.isCommentClosed;
	}

	public void setIsCommentClosed(boolean isCommentClosed) {
		this.isCommentClosed = isCommentClosed;
	}

	@Column(name = "Privacy", nullable = false)
	public int getPrivacy() {
		return this.privacy;
	}

	public void setPrivacy(int privacy) {
		this.privacy = privacy;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Created", nullable = false, length = 23)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Modified", length = 23)
	public Date getModified() {
		return this.modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "diary")
	public Set<DiaryPermission> getDiaryPermissions() {
		return this.diaryPermissions;
	}

	public void setDiaryPermissions(Set<DiaryPermission> diaryPermissions) {
		this.diaryPermissions = diaryPermissions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "diary")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "DiaryInCategory", joinColumns = { @JoinColumn(name = "DiaryId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "CategoryId", nullable = false, updatable = false) })
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

}
